home *** CD-ROM | disk | FTP | other *** search
/ CD ROM Paradise Collection 4 / CD ROM Paradise Collection 4 1995 Nov.iso / os2 / adaptor.zip / ADAPT.ZIP / adaptor / examples / dalib / hostnode / all.f next >
Encoding:
Text File  |  1993-03-23  |  2.0 KB  |  107 lines

  1.       program hostnode
  2.  
  3.       logical okay
  4.  
  5.       call hn1 (okay)
  6.       if (.not. okay) print *, 'ERROR : HostNode 1'
  7.       call hn2 (okay)
  8.       if (.not. okay) print *, 'ERROR : HostNode 2'
  9.       call hn3 (okay)
  10.       if (.not. okay) print *, 'ERROR : HostNode 3'
  11.       call hn4 (okay)
  12.       if (.not. okay) print *, 'ERROR : HostNode 4'
  13.  
  14.       end
  15.  
  16.       subroutine hn1 (okay)
  17.       logical okay
  18.  
  19.       real a(10), ha(10), x
  20. cmf$  layout ha(:host)
  21.  
  22.       forall (i=1:10) a(i) = i
  23.       n = sum (a)
  24.  
  25.       ha = 0
  26.       ha(6:10) = a(4:8)
  27.  
  28.       ha = ha + 1
  29.  
  30.       a(4:8) = ha (6:10)
  31.  
  32.       x = sum (a)
  33.       n = n + 5
  34.       okay = (x .eq. n)
  35.       print *, 'Result is ', x, ' and should be ', n
  36.       end
  37.  
  38.       subroutine hn2 (okay)
  39.       logical okay 
  40.  
  41.       double precision a(10,10), ha(5,5), x
  42.       integer i, j, n
  43.  
  44. cmf$  layout ha(:host)
  45.  
  46.       forall (i=1:10,j=1:10) a(i,j) = i + j
  47.       n = sum (a)
  48.  
  49.       ha = 0
  50.       ha = a(4:8,2:6)
  51.       ha =  ha + 1
  52.       a(4:8,2:6) = ha
  53.  
  54.       n = n + 5*5
  55.       x = sum (a)
  56.       okay = (x == n)
  57.       print *, 'Result is ', x, ' and should be ', n
  58.       end
  59.  
  60.       subroutine hn3 (okay)
  61.       logical okay
  62.  
  63.       double precision a(10,10,10), ha(5,5,5), x
  64.       integer i, j, n
  65.  
  66. cmf$  layout ha(:host)
  67.  
  68.       forall (i=1:10,j=1:10,k=1:10) a(i,j,k) = i + 2*j - k
  69.       n = sum (a)
  70.  
  71.       ha = 0
  72.       ha = a(4:8,2:6,5:9)
  73.       ha = ha + 1
  74.       a(4:8,2:6,5:9) = ha
  75.  
  76.       n = n + 5*5*5
  77.       x = sum (a)
  78.       okay = (x == n)
  79.       print *, 'Result is ', x, ' and should be ', n
  80.       end
  81.  
  82.       subroutine hn4 (okay)
  83.       logical okay
  84.  
  85.       integer a(10,10,10,10)
  86.       integer ha(5,5,5,10), x
  87.       integer i, j, k, l, n
  88.  
  89. cmf$  layout ha(:host)
  90.  
  91.       forall (i=1:10,j=1:10,k=1:10,l=1:10)
  92.         a(i,j,k,l) = i + 2*j - k + 3*l
  93.       end forall
  94.       n = sum(a)
  95.  
  96.       ha = 0
  97.       ha = a(4:8,2:6,5:9,1:10)
  98.       ha = ha + 1
  99.       a(4:8,2:6,5:9,1:10) = ha
  100.  
  101.       n = n + 5*5*5*10
  102.  
  103.       x = sum (a)
  104.       okay = (x .eq. n)
  105.       print *, 'Result is ', x, ' and should be ', n
  106.       end
  107.